home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
VPARM.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-26
|
5KB
|
173 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: vparm.cpp
// Title: VOX and ME/2 Interface
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
// This module contains the program entry point for
//
// The code in this module may be written in C++ or C.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// MS Windows NT
// OS/2 2.X+
// OS/2 2.0 PM
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
//
//----------------------------------------------------------------------------
#include <vox.hpp>
//----------------------------------------------------------------------------
// Stack size
//----------------------------------------------------------------------------
#if COMPILER_BORLAND && (OS_DOS || OS_WINDOWS)
unsigned _stklen = 0x4000;
#endif
//----------------------------------------------------------------------------
// Globals
//----------------------------------------------------------------------------
//
// A useless string which is simply embedded in the executable.
//
PSZ __pszCredits__ = "Written by John M Weeder, 1993";
//
// This should contain a program description which will be displayed as
// part of the program's help text.
//
static PCSZ pcszDescription =
"This program is used to modify a VOX program's configuration";
//
// Program command line options
//
#define MAX_PARAMETERS (50)
#define MAX_TEXT_PARM (40)
static LONG alVal[MAX_PARAMETERS];
static CHAR aszText[MAX_PARAMETERS][MAX_TEXT_PARM+1];
static CHAR szConfig[MAX_PATH+1];
static BS_CMDOPT acmdopt[MAX_PARAMETERS+2] =
{
{ "config", (PVOID)szConfig, CMDOPT_FILESPECR(80), "Configuration file." },
// The remainder are zeroed at startup!!!
};
//----------------------------------------------------------------------------
// Description: main() - Program entry point
// Parameters: Standard C parameters
// Returns: DOS return code.
//----------------------------------------------------------------------------
int main(int argc, char **argv)
{
static BS_CFG cfg = CFG_DFT;
//
// Initialize base library
//
BaseLibraryInitialize(argc, argv, &cfg);
BaseTitle("$Revision: 93.1 $", __DATE__, __TIME__, "VOX Configuration Utility");
//
// Build the command line parameter list dynamically.
// Do not place default values!!!
//
Assert(VX_PARM_MAX <= MAX_PARAMETERS);
for (SIZET i = 0; i < VX_PARM_MAX; ++i)
{
PCSZ pcszName = VX_VOX::GetParmName((VX_PARM)i);
PCSZ pcszPeriod = strchr(pcszName, '.');
if (pcszPeriod)
pcszName = pcszPeriod + 1;
Assert(pcszName && pcszName[0]);
acmdopt[i+1].psz = (PSZ)pcszName;
if (VX_VOX::GetParmType((VX_PARM)i) == VX_PARM_INTEGER)
{
acmdopt[i+1].pv = (PVOID)&alVal[i];
acmdopt[i+1].fs = CMDOPT_NUMERIC|CMDOPT_NO_DFT;
}
else
{
acmdopt[i+1].pv = (PVOID)aszText[i];
acmdopt[i+1].fs = CMDOPT_TEXT(MAX_TEXT_PARM)|CMDOPT_NO_DFT;
}
acmdopt[i+1].pszDesc = (PSZ)VX_VOX::GetParmDesc((VX_PARM)i);
}
//
// Read command line and then open the config file.
//
if (!BaseTitleHelp(acmdopt, pcszDescription))
return 99;
if (!CfgOpen(szConfig))
return 99;
//
// Update any values which were changed.
//
VX_VOX::LoadParms();
for (i = 0; i < VX_PARM_MAX; ++i)
if (BTEST(acmdopt[i+1].fs, CMDOPT_USED))
{
if (VX_VOX::GetParmType((VX_PARM)i) == VX_PARM_INTEGER)
{
VX_VOX::SetParm((VX_PARM)i, alVal[i]);
}
else
{
VX_VOX::SetParm((VX_PARM)i, aszText[i]);
}
}
//
// Finally, display the current values of the parameters!
//
Output("VOX Parameters:\n");
for (i = 0; i < VX_PARM_MAX; ++i)
{
Output(" %s=", VX_VOX::GetParmName((VX_PARM)i));
if (VX_VOX::GetParmType((VX_PARM)i) == VX_PARM_INTEGER)
{
Output("%ld\n", VX_VOX::GetParmInt((VX_PARM)i));
}
else
{
Output("%s\n", VX_VOX::GetParmStr((VX_PARM)i));
}
}
Output("\nSuccess.\n\n");
return 0;
}
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------